﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WMS.Domain
{
    /// <summary>
    /// 订单附件表
    /// </summary>
    public class OrderAttachment
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 关联的已发货订单ID
        /// </summary>
        [Required]
        public int ShippedOrderId { get; set; }

        /// <summary>
        /// 附件类型 (换标附件、收件附件、其他附件等)
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string AttachmentType { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        [Required]
        [MaxLength(255)]
        public string FileName { get; set; }

        /// <summary>
        /// 原始文件名
        /// </summary>
        [MaxLength(255)]
        public string OriginalFileName { get; set; }

        /// <summary>
        /// 文件路径
        /// </summary>
        [Required]
        [MaxLength(500)]
        public string FilePath { get; set; }

        /// <summary>
        /// 文件大小(字节)
        /// </summary>
        public long FileSize { get; set; }

        /// <summary>
        /// 文件扩展名
        /// </summary>
        [MaxLength(10)]
        public string FileExtension { get; set; }

        /// <summary>
        /// MIME类型
        /// </summary>
        [MaxLength(100)]
        public string MimeType { get; set; }

        /// <summary>
        /// 上传时间
        /// </summary>
        public DateTime UploadTime { get; set; }

        /// <summary>
        /// 上传人
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string UploadBy { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool IsValid { get; set; } = true;

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(500)]
        public string Remark { get; set; }

        // 导航属性
        /// <summary>
        /// 关联的已发货订单
        /// </summary>
        [ForeignKey("ShippedOrderId")]
        public virtual ShippedOrder ShippedOrder { get; set; }
    }

}
